home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Tools / BNDL Banger v.1.3 ƒ / Read Me - BNDL Banger v.1.3 < prev   
Text File  |  1992-08-31  |  19KB  |  111 lines

  1. BNDL Banger v.1.3
  2. © Copyright Tim Swihart
  3. August 30, 1992
  4. All Rights Reserved
  5.  
  6.  
  7. (special note:  BNDL Banger v.1.3 supports _ALL_ files that have a bundle!  So, substitute your favorite "file with a BNDL" anywhere in the text below that implies only 'APPL' files are supported.  Rewording each instance of "application" in the rest of this file makes reading it rather cumbersome, so I left it alone and added this note.)
  8.  
  9. BNDL Banger v.1.3 is FreeWare - I retain all rights to it, but place only two restrictions on distribution:
  10.  
  11. 1) This "Read Me" file must be included with BNDL Banger v.1.3.
  12.  
  13. 2) The "BNDL Banger v.1.3 info" file must also be included with BNDL Banger v.1.3.
  14.  
  15. BNDL Banger v.1.3 (and its accompanying files) may be distributed freely (even by the folks that sell disks full of shareware for higher-than-I-think-they-should-be prices).  Naturally, I'd appreciate hearing about anybody that's distributing this application (that way, you can be notified directly of updates).  My address is at the end of this file.
  16.  
  17. BNDL Banger was compiled and linked under Symantec's Think C v.5.0.2, so some parts of BNDL Banger are probably copyright Symantec (their library code for example).  I'm laying no claim to rights that would infringe on their rights.  The only rights I'm claiming are on the unique code I wrote.
  18.  
  19. BNDL Banger is loosely based on the "Super Skeleton" source code that comes with the disk for Addison Wesley's "Programming for System 7" (which I co-wrote along with Gary Little and which you should buy if you don't already have it).  The use of Super Skeleton's source is with express permission of Gary Little and simplified the creation of some parts of BNDL Banger.
  20.  
  21. BNDL Banger is intended to be used under System 7.0 or newer.  BNDL Banger is "System 7 Dependent" and can _NOT_ work under System 6.0.x or any version of the System that was released prior to System 7.0 (so don't even bother to try unless you're really bored).  Why can't BNDL Banger work under pre-System 7.0?  Because some of the key traps called by BNDL Banger didn't exist prior to System 7.0 (like PBDTRemoveAPPL).
  22.  
  23. If you do try to run BNDL Banger v.1.3 under pre-System 7 versions of Macintosh System Software, BNDL Banger figures out what you're trying to do, puts up a dialog reminding you it doesn't work without at least System 7, and quits after you dismiss the dialog.  That's a lot friendlier than how BNDL Banger v.1.0 handled the situation (it bombed, requiring the user to restart the machine, because it was trying to access System 7's Help menu BEFORE it figured out it wasn't running under System 7 — but that's fixed in v.1.1 and higher).
  24.  
  25. BNDL Banger, as the name implies, bangs BNDL resources.  Simply put, it provides an easier way to update an application's BNDL information in a volume's desktop database.  Just drag & drop the desired application onto BNDL Banger's icon and that application's BNDL information will be slammed into the desktop database of the volume on which the selected application exists.  The next time you reboot, that new BNDL information will be used instead of whatever old BNDL information it had (along with whatever new icons you defined for your application, its documents, its editions, etc.).
  26.  
  27. This is generally much more convenient, and far less error prone, than rebuilding the volume's desktop (especially considering that rebuilding the desktop doesn't always produce the desired results - see below for more details).
  28.  
  29. You can also select the application whose BNDL you want to "bang" via the "Banger" menu (there's only one item in that menu, so it's real easy to find the right item).  If you go this route, you'll be presented with the standard open file dialog that only shows applications, folders, and volumes.  Navigate to the application whose BNDL you want to bang and click on the "Open" button.  If the application's BNDL is successfully "banged", you'll be presented with a dialog confirming the action and reminded that you'll need to reboot in order to see the results (sorry, no clean way to avoid the reboot, best I can do is let you avoid rebuilding the desktop).
  30.  
  31. You only get the dialog confirming the "banging" (and reminding you to reboot) if you used the "Banger" menu to select the application whose BNDL you want banged.  If you use the "drag & drop" approach, then the dialog is suppressed (makes it easier to keep BNDL Banger running in the background without forcing you to bring it to the foreground and dismiss a dialog every time you want to bang a BNDL).  If the dialog bugs you, then order "BNDL Banger Pro" (seven bucks, details at the end of this file) — BNDL Banger Pro lets you turn off that dialog (and gives you several other handy features).
  32.  
  33. Regardless of which approach to banging you take (menu vs. "drag & drop"), you'll get at least one beep if the operation worked.  I know, I know, beeps are supposed to indicate errors, not success, but it's was the simplest way to provide some kind of simple confirmation of success when you're just leaving BNDL Banger running in the background.  If there are multiple copies of applications with the same creator type as the incoming application's, then they're all removed from the desktop (this is part of why BNDL Banger v.1.3 is more reliable at "banging" than v.1.0 was).
  34.  
  35. Each time an application is removed from the desktop database, BNDL Banger beeps.  If you have three copies of an application, the first time you run BNDL Banger v.1.3 on that application, you'll hear three beeps.  The next time you run BNDL Banger v.1.3 on that application, you may well only hear _ONE_ beep, that's normal (remember, we removed the other three copies, but _ONLY_ the application you passed into BNDL Banger is added back into the desktop database, the others are no longer in it unless you rebuild the desktop on that volume).  If the beeping bugs you, order BNDL Banger Pro — that way, you'll have the ability to turn off the beeps.
  36.  
  37. If you try to bang an application twice in a row, without rebooting in between, it's possible that its BNDL information will not yet have been added back into the desktop database, so the PBDTRemoveAPPL will fail and you won't get a confirmation of success.  Don't panic, just reboot (like you should have after the first time you banged the application's BNDL) and all should work just fine again.
  38.  
  39. Before I go any further, let me explain just exactly what I mean by "banging" an application's BNDL.  Under System 7, volumes with at least 2 megs on them have a desktop database instead of the old desktop resource file.  System 7 provides traps that let applications work with the desktop database if they really need to (BNDL Banger really needs to).  So, when an application has been selected for "banging", BNDL Banger calls PBDTRemoveAPPL on the desktop database that's on the same volume as the application being banged.  Then, the "hasBeenInited" bit in the application's Finder Info is cleared and written back to the application's volume.  This tricks the System into thinking it's never before seen this application (since it has no record of it in the desktop database) and the application hasn't been inited (because we cleared its "hasBeenInited" bit), so the System extracts the BNDL information (and related resources - 'FREF', ICN#', etc.) and adds it to that volume's desktop database.
  40.  
  41. NOTE:  In order for the Finder to "notice" your application has been banged, you'll need to open the window that contains your application.  Otherwise, the "hasBeenInited" bit will stay clear for quite some time.  Since BNDL Banger is intended for use with application's you're developing, I don't see this as a problem worth solving (you'll be working in the same folder as your app anyways most likely, so it'll be open and all will be well with the world).  Your icon will probably move to a different position once the Finder reads its BNDL-related information and sets the "hasBeenInited" bit.  There's no simple solution to this "problem" — the best thing to do is ignore it.  The next best thing to do is move the icon back where you want it to be.
  42.  
  43. Without a tool like BNDL Banger, it's a "hit or miss" proposition, with lots of hidden "gotcha's", as you try to make new versions of application/document icons show up, make new foreign file types work properly with "drag & drop", or make any BNDL-related changes take effect.
  44.  
  45. The Finder caches the information from the desktop database (it's faster than re-reading it every time), so you won't see the new information until you reboot (rebooting forces the Finder to re-read the BNDL-related information).  Do _NOT_ rebuild your desktop when you reboot!  Rebuilding your desktop can cause the BNDL information from a DIFFERENT copy of your application (if you have more than one copy hanging around) to be used for the volume's desktop database (the first file with a given creator type that's found is the one that's used for the desktop database during a rebuild which is one of the major stumbling blocks that gets in the way of cleanly updating your application's BNDL-related information...).
  46.  
  47. Floppies have less than 2 megs of storage space, so they do NOT have a desktop database and you can NOT "bang" applications that live on floppies.  You can try, but BNDL Banger checks the target volume for the presence of a desktop database and ONLY calls PBDTRemoveAPPL if there is a desktop database...
  48.  
  49. Since floppies don't have a desktop database, drag & drop won't work if BNDL Banger is on a floppy (that's the System's fault not mine).  So, keep BNDL Banger on a hard drive (or some other volume with more than 2 megs of storage space).
  50.  
  51. If you have multiple volumes online, then you CAN run into some situations where BNDL Banger will appear not to have worked even though you got a confirmation dialog that said it did work and even though you remembered to reboot after banging your application's BNDL.  To understand why, let's pretend your application being developed is on your non-boot drive and that you have a "spare" copy of it on your boot drive.  You change your application's icon (or make some other BNDL-related change) and run your application through BNDL Banger.  Even after rebooting, you'll still see the old BNDL information because the System uses the FIRST occurrence of your application's signature it comes across - which in this case is the older version of your application that happens to be on your boot volume.
  52.  
  53. The best way to handle this is only have one drive online that has more than 2 megs of storage (which is what most people will have).  The next best way to handle this is to keep your application _ONLY_ on one volume and NEVER let it exist (not even briefly) on the other volume.  That way, its BNDL information will never be added to the other volume's desktop database and you won't get the conflict mentioned in the paragraph above.
  54.  
  55. If your application is ever copied to your "other" drive, you'll need to remove it (and any documents bearing your application's creator type) and rebuild it's desktop.  Fun, eh?  Can't blame that hassle on 'BNDL Banger', the System's always sort of been this way (and it's just this sort of hassle that drove me to write BNDL Banger).
  56.  
  57. The "multi—volume" problem is solved in "BNDL Banger Pro" (which is available for $7, see the ordering information near the end of this file for details).  BNDL Banger Pro lets you pick whether or not all online volumes are banged — BNDL Banger v.1.3 only bangs the volume that contains the application you selected.
  58.  
  59. Like all good System 7 applications, BNDL Banger includes Balloon Help for all the key items (menus, menu items, major parts of its dialogs, etc.).  It even adds a "tutorial" item to the Help menu (the one on the right hand side of the menu bar that looks like a help balloon with a question mark in the middle of it) - the tutorial item presents a simple dialog full of quick reminders about what BNDL Banger does and how to use it.
  60.  
  61. System 7's "drag & drop" apparently wasn't expecting any application to ever want to allow ONLY other applications to be supported as "foreign documents".  As a result, the only documented way to get "drag & drop" to work when you drag another application icon on top of BNDL Banger's icon is to specify the wildcard ('****') foreign file type.  While this does allow application icons to be "dropped" on top of BNDL Banger's icon, it also allows (and there's no way to prevent this) ANY other icon (except folder icons and disk icons) to be dropped on top of BNDL Banger's icon and BNDL Banger will be launched as a result.  So, I had to add a couple of lines of code to verify the incoming file has it's "hasBundle" Finder info flag set (documents don't have a BNDL to bang, so no sense supporting them).  If the incoming file doesn't have that bit set, then BNDL Banger simply ignores it and exits.  Since no banging was done, no confirmation beep is sounded.
  62.  
  63. Some applications have BNDL resources, but don't have their "hasBundle" Finder info flag set properly.  As a result, BNDL Banger treats them like non-applications (refusing to bang them and not letting them show up in the standard file dialog when selecting an application to bang).  ResEdit will let you correct your application's Finder info flags, as will several other utilities.
  64.  
  65. Before I wrote BNDL Banger, I mentioned the need for such a utility to a friend of mine who immediately said, "Oh, I wrote one of those while I was in Japan...".  To which I naturally said, "Great, can I have a copy of it?".  While he agreed to send me a copy of it, the copy never arrived, so I wrote my own (I always wanted to write my own and this was as good of an excuse as any other).  So, somewhere in the world, another similar application exists (and existed before BNDL Banger), but as of the time I'm writing this, I haven't yet seen it...
  66.  
  67. After I released BNDL Banger v.1.0, another similar utility was created by someone else.  BNDL Banger was first, but it's worth pointing out that an alternative does exist. It's known as "Save A BNDL" and you can probably find it pretty much anywhere you can find BNDL Banger.
  68.  
  69. Because it was fairly simple to write, because a similar tool already existed, because it's something I would have done for myself anyway, because I was already very familiar with the desktop database, and because I'm such a nice guy (and so modest too), I'm releasing BNDL Banger v.1.3 as FreeWare.  However, in the interest of making a buck (hey, I live in America, I'm supposed to be enterprising...), the source code (in Think C v.5.0.2  and Rez/SARez format) is available on one 800K disk for seven dollars ($7, U.S. currency please).  Send your check or money order (the U.S. Post Office discourages sending cash through the mail and I really don't blame them).  Send your money to:
  70.  
  71. Tim Swihart
  72. Swihart's Software
  73. P.O.Box 160643
  74. Cupertino, CA  95016
  75.  
  76. To sweeten the deal ("Seven bucks for a lousy floppy?"), I'll toss in a more powerful version of BNDL Banger (known as "BNDL Banger Pro v.2.1") and the source code for both BNDL Banger and BNDL Banger Pro.
  77.  
  78. BNDL Banger Pro v.2.1 was completed _BEFORE_ BNDL Banger v.1.3 (which means you can order BNDL Banger Pro now) and has the following additional features:
  79. • Preferences Menu allowing user to control:
  80. - Whether or not a beep is sounded in confirmation of a successful banging (if the beep bugs you, turn it off).
  81. - Whether a custom sound (one I created) or your regular system beep is used when confirming success.  This makes it easier to tell BNDL Banger Pro's beeps apart from other beeps.
  82. - Whether or not the confirmation dialog is displayed when using BNDL Banger Pro interactively (i.e.:  via the "Banger" menu instead of via drag & drop).
  83. - Whether all online volumes are banged or just the volume containing the incoming file.
  84. - Auto-quit options (see below).
  85. • Multiple auto-quit times to select from.  This allows you to have BNDL Banger Pro quit for you when it's running in the background.  Default times are one minute, ten minutes, and one hour.  Naturally, a "Don't Auto-quit" option is available.  Since source code is included with BNDL Banger Pro, it's fairly simple to change the default times to whatever you prefer they be.
  86. • You can also tell BNDL Banger Pro to Auto-quit once it's banged something.  This lets you skip having to quit BNDL Banger Pro after you dropped something onto its icon.
  87. • Preferences are written to your boot disk (in the Preferences folder of course) and automatically used each time BNDL Banger Pro is launched.  This lets you run BNDL Banger Pro interactively one time, set up an auto-quit option (and other preferences) and those preferences will be used, even when just using drag & drop, each time BNDL Banger Pro is launched.
  88. • There's an option to restore the default preferences (default = my personal preferences that I built in).
  89. • The source code for BNDL Banger Pro v.2.1 is also included in the deal.  That source is ready to compile under either MPW 3.2.x or Think C v.5.0.2.
  90.  
  91. Feel free to suggest other features, but bear in mind that your seven bucks gets you the source code as well, so I may suggest that you be the one to implement some of your suggestions.
  92.  
  93. My source code is fairly heavily commented, the comments are written at the same time the source is, not later on when I've half forgotten what the source is doing (I'm one of those sicko programmers that comments their code literally as the code is written - like they always try to teach you to do in college, but many folks never really listen...).  That means it should be real easy to figure out what I did and add features of your own.
  94.  
  95. BNDL Banger is Apple event aware (required events only), so you could conceivably send it an Apple event telling it to bang an application for you (just send an 'odoc' event like the Finder does).  Not many developers are likely to care about this, but if you happen to be working on developer tool-related applications/environments...  Besides, you could send a 'quit' event to force BNDL Banger to quit without having to bring it to the foreground, select Quit from the File menu, etc.
  96.  
  97. To report bugs, send suggestions, or offer constructive criticism, I can be reached at any of the following:
  98.  
  99. GEnie:  Tim.Swihart
  100. America Online:  A2Pro Tim
  101. AppleLink:  Tim.Swihart
  102. Snail mail:  Tim Swihart
  103.                    Swihart's Software
  104.                    P.O.Box 160643
  105.                    Cupertino, CA  95016
  106.  
  107.  
  108. Enjoy BNDL Banger!
  109. Tim S.
  110. (revision history is in the "BNDL Banger v.1.3 info" file).
  111.